﻿@using ThuySan.Areas.Backend.Models
@using ThuySan.Models
@model ThuySan.Models.ImageModel
@{
    Layout = "~/Areas/Backend/Views/Shared/_Layout.cshtml";
    Header header = new Header {
                                       Common = "ViewUserControl_Banner_Add",
                                       PageHeader = "Edit Banner",
                                       Menulv1 = "02",
                                       Menulv2 = "0204"
                               };
    ViewData[Header.Key] = header;
    ViewBag.Title = "Edit Banner - Admin Control Panel";
}
<div class="content-box">
    <div class="content-box-header">
        <h3>
            Chỉnh sửa Banner</h3>
    </div>
    <div class="content-box-content">
        @using (Html.BeginForm("Edit", "Banner", FormMethod.Post, new {
                                                                              enctype = "multipart/form-data"
                                                                      }))
        {
            @Html.ValidationMessage("error")
            <div class="input-item">
                <label>
                    Sản phẩm</label>
                @Html.DropDownListFor(c => c.ProductId, (IEnumerable<SelectListItem>) ViewBag.Products, new {
                                                                                                                    style = "width: 300px;"
                                                                                                            })
            </div>
            <div class="input-item">
                <label>
                    Hình ảnh </label>
                @if (!string.IsNullOrEmpty(Model.ImageName))
                {
                    <img src="@Html.UploadPath("Products")@Model.ImageName" width="200" />
                    <br />
                }
                <input type="file" name="thumbnail" id="thumbnail" />
                @Html.ValidationMessageFor(c => c.ImageName)
            </div>
            <div class="input-item">
                <label>
                    Độ ưu tiên</label>
                @Html.TextBoxFor(c => c.Priority, new {
                                                              @class = "text-input tiny-input"
                                                      })
                @Html.ValidationMessageFor(c => c.Priority)
            </div>
            <div class="input-item">
                <label>
                    Chú thích</label>
                @Html.TextAreaFor(c => c.Description, new {
                                                                  @class = "text-input large-input"
                                                          })
                @Html.ValidationMessageFor(c => c.Description)
            </div>
            <input type="submit" value="Cập nhật" class="button" />
            <input type="button" onclick="javascript:window.location.href='@Url.Action("Index")';" value="Reset" class="button" />
        }
    </div>
</div>